package com.wtwd.campus.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wtwd.campus.entity.Student;
import com.wtwd.campus.entity.StudentSchoolData;
import com.wtwd.campus.entity.VoStudent;
import com.wtwd.campus.wx.entity.WxUserStudentPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author mjy
 * @date 2021/06/11
 * @description
 */
@Mapper
public interface StudentMapper extends BaseMapper<Student> {
    Integer getStudentCountBySchoolIdList(@Param("schoolIdList") List<Integer> schoolIdList);

    Student getStudentByStudentNoAndSchoolId(@Param("schoolId") Integer schoolId,@Param("stuNo") String stuNo);

    Integer addStudent(VoStudent voStudent);

    IPage<Map<String, Object>> getStudentListByCondition(@Param("searchMap") Map searchMap, @Param("page") Page<Student> page);

    Integer updateStudent(@Param("voStudent") VoStudent voStudent);

    Integer deleteStudent(@Param("studentId") Integer studentId);

    List<Map<String,Object>> getWxUserByStudentId(@Param("studentId") Integer studentId);

    Student getStudentByStuPhone(@Param("stuPhone") String stuPhone);

    Student getStudentByStudentNoAndSchoolName(@Param("schoolName") String schoolName,@Param("stuNo") String stuNo);

    int batchAddStudent(@Param("list") List<Student> students);

    Integer updateStudentWxUserBindStatus(@Param("bindingWechat") Integer bindingWechat,@Param("studentId") Integer studentId);

    /**
     * 根据学生id查询学生信息
     * @param studentId
     * @return
     */
    Student getStudentInfoById(@Param("studentId") Integer studentId);

    Map<String, Object> getStudentByStuId(Integer stuId);

    String getImeiByStuId(Integer stuId);

    Map<String,Object> getStuNameAndClassNameByStuId(Integer stuId);

    Map<String,Object> getStuNameAndClassNameByDeviceId(Integer deviceId);

    List<String> getImeiListByStuIdList(@Param("list") List<Integer> stuIdList);

    List<Map<String,Object>> getStuByNameAndStuNo(@Param("name") String name,@Param("stuNo") String stuNo);

    String getSchoolOrgCodeByStuId(@Param("stuId") Integer stuId);

    List<Map<String,Object>> getSchoolOrgCodeListByStuIdList(@Param("list") List<Integer> list);

    Map<String,Object> getSchoolIdAndClassIdByStuId(@Param("stuId") Integer stuId );

    Map<String,Object>  getStuBindingMessByStuId(@Param("stuId") Integer stuId);

    Map<String,Object>  getStuMessByStuId(@Param("stuId") Integer stuId);

    int getStudentNumberByClassId(@Param("classId") Integer classId);

    List<Map<String,Object>> getStudentAttendanceRecord(@Param("classId") Integer classId,@Param("time") Long time);

    List<Map<String, Object>> getJdzcUserByStudentId(@Param("studentId") Integer studentId);

    StudentSchoolData getStudentInfoByCustomerCodeAndStundetNameAndStudentNo(@Param("customerCode") String customerCode, @Param("name") String name, @Param("stuNo") String stuNo);

    List<WxUserStudentPermission> getWxUserStudentPermissionByStudentId(@Param("studentId") Integer studentId);
}
